package com.eyealike.client;

import com.eyealike.vsp.bindings.ErrorResponse;

public class EyealikePlatformException extends Exception
{
	private static final long serialVersionUID = - 4737363136970816428L;

	private final ErrorResponse errorResponse;

	public EyealikePlatformException( final int errorCode, final String errorDescription )
	{
		this( createErrorResponse( errorCode, errorDescription ) );
	}

	private static ErrorResponse createErrorResponse( final int errorCode, final String errorDescription )
	{
		final ErrorResponse errorResponse = new ErrorResponse();
		errorResponse.setErrorCode( errorCode );
		errorResponse.setErrorDescription( errorDescription );
		return errorResponse;
	}

	public EyealikePlatformException( final ErrorResponse response )
	{
		super( response.getErrorDescription() );
		errorResponse = response;
	}

	public ErrorResponse getErrorResponse()
	{
		return errorResponse;
	}
}
